﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
using System.IO;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using LumenWorks.Framework.IO.Csv;




namespace LP_Csharp
{
    public partial class Form1 : Form
    {
        //Inicializacao dos users controles
        importcsv imp_csv;
        estatisticas estatic;
        acerca about;
        ajuda help;
        
        public Form1()
        {
            InitializeComponent();
        }
        /*##############################################################################################################*/
        //CODIGO PARA O SAIR DA BARRA DE MENUS
        private void sairToolStripMenuItem_Click(object sender, EventArgs e)
        {
             if (MessageBox.Show("Deseja mesmo sair?", "Informação", MessageBoxButtons.YesNo)
             == DialogResult.Yes)
             {
                   Application.Exit();
            }
         }

       /*##############################################################################################################*/
        //CODIGO PARA O IMPORT CSV DA BARRA DE MENUS
        private void importarCSVToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //desativa a imagem e label do form principal
            this.pictureBox1.Visible = false;
            this.label1.Visible = false;

            /*Condicoes para apagar/chamar os userControls*/
            if (estatic != null)
            {
                this.estatic.Dispose();
                this.estatic = null;
            }

            if (about != null)
            {
                this.about.Dispose();
                this.about = null;
            }
            if (help != null)
            {
                this.help.Dispose();
                this.help = null;
            }
            if (this.imp_csv == null)
            {
                this.imp_csv = new importcsv(this);
            }
        }

        /*##############################################################################################################*/
        //CODIGO PARA AS ESTATISTICAS DA BARRA DE MENUS
        private void estatisticasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //desativa a imagem e label do form principal
            this.pictureBox1.Visible = false;
            this.label1.Visible = false;

            /*Condicoes para apagar/chamar os userControls*/
            if (imp_csv != null)
            {
                this.imp_csv.Dispose();
                this.imp_csv = null;
            }
            if (about != null)
            {
                this.about.Dispose();
                this.about = null;
            }
            if (help != null)
            {
                this.help.Dispose();
                this.help = null;
            }
            if (this.estatic == null)
            {
                this.estatic = new estatisticas(this);
            }
        }

        private void ajudaToolStripMenuItem1_Click(object sender, EventArgs e)
        {
           //desativa a imagem e label do form principal
            this.pictureBox1.Visible = false;
            this.label1.Visible = false;

            /*Condicoes para apagar/chamar os userControls*/
            if (imp_csv != null)
            {
                this.imp_csv.Dispose();
                this.imp_csv = null;
            }
            if (estatic != null)
            {
                this.estatic.Dispose();
                this.estatic = null;
            }
            if (help != null)
            {
                this.help.Dispose();
                this.help = null;
            }
            if (this.about == null)
            {
                this.about = new acerca(this);
            }
        }

        private void acercaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //desativa a imagem e label do form principal
            this.pictureBox1.Visible = false;
            this.label1.Visible = false;

            /*Condicoes para apagar/chamar os userControls*/
            if (imp_csv != null)
            {
                this.imp_csv.Dispose();
                this.imp_csv = null;
            }
            if (estatic != null)
            {
                this.estatic.Dispose();
                this.estatic = null;
            }
            if (about != null)
            {
                this.about.Dispose();
                this.about = null;
            }
            if (this.help == null)
            {
                this.help = new ajuda(this);
            }
        }
        }
    }
